home *** CD-ROM | disk | FTP | other *** search
-
- ; $VER: ActiveWindow.bb2 v1.1 (30.08.2000)
-
- ; Author: Damir Arh
- ; E-mail: damir.arh@telesat.si
- ; WWW: http://damir.gajba.net/
-
- ; This source code is completely free. You can redistribute
- ; and/or modify it without any restrictions whatsoever.
-
- ;-------------------------------------------------------------
-
- ; This source code demonstrates how to open a window which
- ; automaticaly activates itself as long as its screen is
- ; the front one.
-
- ; The routine is particularily useful in cases where you
- ; open your own screen and a window on it which then
- ; receives all the events through IDCMP messages and also
- ; changes the pointer. By using this routine you can always
- ; know when your screen is the front one and you can
- ; activate the window without the user having to intervene.
-
- ;-------------------------------------------------------------
-
-
- WBStartup
- WBenchToFront_
- FindScreen 0
- ; this message tells you when your window gets inactive
- AddIDCMP #IDCMP_INACTIVEWINDOW
- Window 0,10,10,300,150,#WFLG_ACTIVATE+#WFLG_DRAGBAR+#WFLG_CLOSEGADGET+#WFLG_DEPTHGADGET+#WFLG_SIZEGADGET,"ActiveWindow",1,3
-
- While True
-
- Select WaitEvent
-
- Case #IDCMP_INACTIVEWINDOW
-
- ; our window is now inactive
- InBack.b=True
- ; wait for the screen to get in front
- While InBack
-
- lock.l = LockIBase_(0)
- *ib._IntuitionBase = IntuitionBase
- *firstscreen._Screen = *ib\FirstScreen
- UnlockIBase_(lock)
-
- If Peek.l(Addr Screen(0)) = *firstscreen
- InBack.b=False
- EndIf
-
- Delay_(20)
-
- Wend
- ; the screen is in front - activate window
- Activate 0
-
- Case #IDCMP_CLOSEWINDOW
-
- End
-
- End Select
-
- Wend
-
-